{template 'common/header'}
<div id="js-wxapp-create" class="account-list-add" ng-controller="WxappCreateCtrl">
	{if $_W['iscontroller']}
	<ol class="breadcrumb we7-breadcrumb">
		<a href="{php echo url ('account/manage/display')}"><i class="wi wi-back-circle"></i></a>
		<li><a href="{php echo url ('account/manage/display')}">平台列表</a></li>
		<li>新建小程序</li>
	</ol>
	{/if}
	<div class="panel we7-panel">
		<div class="panel-body we7-padding">
			<div class="col-lg-4 list-item">
				<span class="img img-pen"></span>
				<div class="info">
					<div class="title">
						<a href="javascript:;">手动添加小程序</a>
					</div>
					<div class="con">
						通过<a href="javascript:openUrl('https://mp.weixin.qq.com')" class="color-default">微信公众平台</a>
						开发设置获取AppID和AppSecret，添加成功后，将 <span class="color-default">{$wxapp_url}</span> 添加到微信公众平台合法域名
					</div>
					<div class="action">
						
						
						<!--<a href="{php echo url('wxapp/post/post', array('design_method' => WXAPP_MODULE, 'uniacid' => $uniacid))}" class="btn btn-primary">手动添加小程序</a>-->
						<a href="{php echo url('account/create', array('sign' => 'wxapp'))}"
							class="btn btn-primary">手动添加小程序</a>
						
					</div>
				</div>
			</div>
			<div class="col-lg-4 list-item">
				<span class="img img-tel"></span>
				<div class="info">
					<div class="title">
						授权添加小程序
					</div>
					<div class="con">
						{if $_W['isadmin']}
						使用授权添加需认证微信开放平台和全网发布，并在创始人端->平台管理->微信开放平台中启用
						{else}
						使用公众平台绑定的管理员个人微信扫码即可快速添加
						{/if}
					</div>
					<div class="action">
						<a href="javascript:;" ng-click="checkWxappLimit()" class="btn btn-primary">授权添加小程序</a>
					</div>
				</div>
			</div>
		</div>
	</div>
</div>
<script>
	angular.module('wxappCreate', []);
	angular.module('wxappCreate').value('config', {
		wxapp_url: "{$wxapp_url}",
		links: {
			checkWxappLimitUrl: "{php echo url('wxapp/post/design_method')}",
		}
	});
	angular.module('wxappCreate').controller('WxappCreateCtrl', ['$scope', '$http', 'config', function ($scope, $http, config) {
		$scope.checkWxappLimit = function () {
			$http.post(config.links.checkWxappLimitUrl).success(function (data) {
				if (data.message.errno == 0) {
					window.location.href = data.message.message.url;
				} else {
					util.message(data.message.message, '', 'error');
				}
			});
		};
	}]);
	angular.bootstrap($('#js-wxapp-create'), ['wxappCreate']);
</script>
{template 'common/footer'}